package com.cn.fangshuo.enums;

import lombok.Getter;

@Getter
public enum CarTypeEnum {
    //目前除了1之外都显示其他
    OTHER0("other", 0, "其他"),
    TIPPER("tipper", 1, "渣土车"),
    OTHER2("other", 2, "其他");

    private String name;

    private int code;

    private String desc;

    CarTypeEnum(String name, Integer code, String desc) {
        this.name = name;
        this.code = code;
        this.desc = desc;
    }

    public static CarTypeEnum getCarType(int code) {
        for (CarTypeEnum carTypeEnum : CarTypeEnum.values()) {
            if (carTypeEnum.getCode() == code) {
                return carTypeEnum;
            }
        }
        return null;
    }
}
